package logic

import (
	"context"
	"home-mgr/model"

	"home-mgr/homerpc/homerpc"
	"home-mgr/homerpc/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type SpekShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewSpekShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SpekShowLogic {
	return &SpekShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *SpekShowLogic) SpekShow(in *homerpc.SpekShowRequest) (*homerpc.SpekShowResponse, error) {
	// todo: add your logic here and delete this line

	var spek model.Spek
	model.DB.Debug().First(&spek)
	return &homerpc.SpekShowResponse{
		UserId:  int64(spek.UserId),
		HouseId: int64(spek.HouseId),
		Text:    spek.Text,
	}, nil
}
